package com.example.ui_view.service;

import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.content.Context;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;
import androidx.core.app.NotificationCompat;

import com.example.ui_view.R;

/**
 * An {@link IntentService} subclass for handling asynchronous task requests in
 * a service on a separate handler thread.
 * <p>
 * TODO: Customize class - update intent actions, extra parameters and static
 * helper methods.
 */
public class MyJobIntentService extends JobIntentService {

    @Override
    protected void onHandleWork(@NonNull Intent intent) {
        try {
            Thread.sleep(5000);
        }catch (Exception e){
            e.printStackTrace();
        }
        if(intent!=null){
            Log.v("msg",intent.getStringExtra("str_name"));
            ResultReceiver resultReceiver = (ResultReceiver) intent.getExtras().get("receiver_key");
            Bundle bundle = new Bundle();
            bundle.putString("str_key","str_value");
            resultReceiver.send(0x111,bundle);
        }
    }
}
